package org.chengn.level_easy.context746;

/**
 * @Title: Context746
 * @Author ChengN
 * @Package org.chengn.level_easy.context746
 * @Date 2023/12/17 19:25
 * @description: 使用最小花费爬楼梯
 */
public class Context746 {
    public int minCostClimbingStairs(int[] cost) {
        int len = cost.length;
        int[] ans = new int[len + 1];
        for (int i = 2; i <= len; ++i) {
            ans[i] = Math.min(ans[i - 2] + cost[i - 2], ans[i - 1] + cost[i - 1]);
        }
        return ans[len];

    }
}
